package com.ruoyi.web.controller.review;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.review.domain.SysInterflow;
import com.ruoyi.review.service.ISysInterflowService;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 问答Controller
 * 
 * @author YJF
 * @date 2023-05-08
 */
@RestController
@RequestMapping("/review/interflow")
public class SysInterflowController extends BaseController
{
    @Autowired
    private ISysInterflowService sysInterflowService;

    /**
     * 查询问答列表
     */
    @PreAuthorize("@ss.hasPermi('review:interflow:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysInterflow sysInterflow)
    {
        startPage();
        List<SysInterflow> list = sysInterflowService.selectSysInterflowList(sysInterflow);
        return getDataTable(list);
    }

    /**
     * 获取问答详细信息
     */
    @PreAuthorize("@ss.hasPermi('review:interflow:query')")
    @GetMapping(value = "/{interflowId}")
    public AjaxResult getInfo(@PathVariable("interflowId") Long interflowId)
    {
        return AjaxResult.success(sysInterflowService.selectSysInterflowByInterflowId(interflowId));
    }

    /**
     * 新增问答
     */
    @PreAuthorize("@ss.hasPermi('review:interflow:add')")
    @Log(title = "问答", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysInterflow sysInterflow)
    {
        return toAjax(sysInterflowService.insertSysInterflow(sysInterflow));
    }

    /**
     * 修改问答
     */
    @PreAuthorize("@ss.hasPermi('review:interflow:edit')")
    @Log(title = "问答", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysInterflow sysInterflow)
    {
        return toAjax(sysInterflowService.updateSysInterflow(sysInterflow));
    }

    /**
     * 删除问答
     */
    @PreAuthorize("@ss.hasPermi('review:interflow:remove')")
    @Log(title = "问答", businessType = BusinessType.DELETE)
	@DeleteMapping("/{interflowIds}")
    public AjaxResult remove(@PathVariable Long[] interflowIds)
    {
        return toAjax(sysInterflowService.deleteSysInterflowByInterflowIds(interflowIds));
    }
}
